<xsl:variable name="periode">periode 5</xsl:variable>

<xsl:template match='/'>
\documentclass{article}
\usepackage[dutch]{babel}
\usepackage[latin1]{inputenc}
\usepackage{array}
\usepackage{a4wide}
\pagestyle{empty}
\renewcommand{\arraystretch}{1.3}
\setlength\textheight{28cm}
\setlength\textwidth{19cm}
\addtolength\voffset{-2.5cm}
\addtolength\hoffset{-2.2cm}
\setlength{\tabcolsep}{0.1cm}
\begin{document}
\noindent
\subsection*{Sint-Ritacollege <xsl:value-of select='//rapport[1]/@jaar' />-<xsl:value-of select='//rapport[1]/@jaar + 1' /> \hfill Overzicht cijfers <xsl:value-of select='//rapport[1]/leerling/klas' /> \hfill Maandrapport <xsl:value-of select='$periode' />}
\hrule
\mbox{}
\\[0.5cm]
\noindent
\begin{tabular}{|p{4cm}<xsl:for-each select="//rapport[1]/vakken/*">|c</xsl:for-each>||p{0.8cm}&lt;{\centering}|}
  \hline
&amp;<xsl:for-each select="//rapport[1]/vakken/*"><xsl:value-of select="name()" />&amp;</xsl:for-each>TOT\\ 
  \hline\hline
<xsl:for-each select="//rapport"><xsl:call-template name="vakcijfers" /></xsl:for-each>
  \hline\hline
Totaal &amp; <xsl:for-each select="//rapport[1]/vakken/*"><xsl:value-of select="c5gem" />&amp;</xsl:for-each><xsl:value-of select="//rapport[1]/totaal/tot5gem" /> \\
  \hline
\end{tabular}
\end{document}
</xsl:template>

<xsl:template name="vakcijfers">
   <xsl:value-of select="leerling/voornaam" />&#160;<xsl:value-of select="leerling/achternaam" /> &amp;<xsl:for-each select="vakken/*"><xsl:value-of select="c5" /> &amp; </xsl:for-each><xsl:value-of select="totaal/tot5" />\\
</xsl:template>